package java_collection.varargs;

import static java.lang.System.out;

public class VarargsExample {
	
	public static void main(String args[]) {
		
		// We can call sum method
		// with any number of int arguments.
		out.println( sum(10,20) );
		out.println( sum(10,20,30) );
		
    }
    
    static int sum (int... numbers){
       int total = 0;
       for (int i = 0; i < numbers.length; i++)
            total += numbers [i];
       return total;
    }
}
